﻿using SuiYuan.Demo.Pages;
using SuiYuan.UI.Controls.NaviMenu;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace SuiYuan.Demo
{
    /// <summary>
    /// MainWindow2.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow2 : Window
    {
        private Dictionary<string, UserControl> controlDict;
        public MainWindow2()
        {
            InitializeComponent();
            InitMenu();
        }

        /// <summary>
        /// 初始化左侧菜单
        /// </summary>
        private void InitMenu()
        {
            List<LayUIMenu> list = new List<LayUIMenu>();
            list.Add(new LayUIMenu
            {
                IconText = "&#xe718;",
                Text = "基本元素",
                SubMenuList = new LayUIMenu[] {
                    new LayUIMenu { Text = "按钮" },
                    new LayUIMenu { Text = "表单" },
                    new LayUIMenu { Text = "选项卡" },
                    new LayUIMenu { Text = "进度条" },
                    new LayUIMenu { Text = "表格" } }.ToList()
            });
            list.Add(new LayUIMenu
            {
                IconText = "&#xe857;",
                Text = "组件示例",
                SubMenuList = new LayUIMenu[] {
                    new LayUIMenu { Text = "弹出层" },
                    new LayUIMenu { Text = "时间日期选择" },
                    new LayUIMenu { Text = "分页" },
                    new LayUIMenu { Text = "文件选择" },
                    new LayUIMenu { Text = "颜色选择器" },
                    new LayUIMenu { Text = "滑块" },
                    new LayUIMenu { Text = "评分" }
                }.ToList()
            });
            navi.ItemsSource = list;


            controlDict = new Dictionary<string, UserControl>();
            controlDict.Add("按钮", new ButtonPage());
            controlDict.Add("表单", new FormPage());
            controlDict.Add("选项卡", new TabControlPage());
            controlDict.Add("进度条", new ProgressPage());
            controlDict.Add("表格", new EmptyPage());
            controlDict.Add("弹出层", new DialogPage());
            controlDict.Add("时间日期选择", new EmptyPage());
            controlDict.Add("分页", new EmptyPage());
            controlDict.Add("文件选择", new EmptyPage());
            controlDict.Add("颜色选择器", new EmptyPage());
            controlDict.Add("滑块", new SliderPage());
            controlDict.Add("评分", new EmptyPage());
            WhichPanelShow("表单");
        }

        private void WhichPanelShow(string text)
        {
            Contents.Content = controlDict[text];
        }

        private void navi_ItemClick_1(object sender, RoutedEventArgs e)
        {
            LayUIMenu menu = e.OriginalSource as LayUIMenu;
            WhichPanelShow(menu.Text);
        }
    }
}
